package com.fcscs.cservice.client.main.iguestusers;

import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.Label;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.form.AdapterField;
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
import com.fcscs.core.gwt.common.CoreConstants;
import com.fcscs.core.gwt.common.FormSubmitListener;
import com.fcscs.core.gwt.common.ui.BaseFormDialog;
import com.fcscs.core.gwt.common.ui.FcsFields.FormButton;
import com.fcscs.core.gwt.common.ui.FcsFormPanel;
import com.fcscs.cservice.client.common.CServiceConstants;
import com.fcscs.cservice.client.common.model.iguestusers.iGuestUsersModel;
import com.fcscs.cservice.client.main.restaurants.GuestBookingHistoryGrid;
import com.fcscs.share.gwt.common.ShareGWTConstants;


public class iGuestUsersDetailDialog extends BaseFormDialog<iGuestUsersModel> {
	private static iGuestUsersDetailDialog INSTANCE;
	private MyFormPanel myFormPanel;
	
//	private GuestBookingHistoryGrid bookHisGrid;
	

	public static iGuestUsersDetailDialog getInstance() {

		if (null == INSTANCE) {
			INSTANCE = new iGuestUsersDetailDialog();
		}
		//INSTANCE.bookHisSearch();
		INSTANCE.setHeading(CServiceConstants.CSERVICE_CONSTANTS.iGuestUsersProfile());
		return INSTANCE;
	}

	private iGuestUsersDetailDialog() {
		myFormPanel = new MyFormPanel(null);
		add(myFormPanel);
		setSize(300, 450);
	}

	public class MyFormPanel extends FcsFormPanel<iGuestUsersModel> {//replace iGuestUsersModel by FolioView
		private LayoutContainer lc1;
		
		private Label folioNoLabel;
		private AdapterField folioNoAF;
		
		private Label guestNameLabel;
		private AdapterField guestNameAF;
		
		private Label roomNoLabel;
		private AdapterField roomNoAF;
		
		private Label extensionNoLabel;
		private AdapterField extensionNoAF;
				
		private Label vipLevelLabel;
		private AdapterField vipLevelAF;
		
		private Label groupIdLabel;
		private AdapterField groupIdAF;
		
		private Label iGuestAccountLabel;
		private AdapterField iGuestAccountAF;
		
		private Label usernameLabel;
		private AdapterField usernameAF;
		
		private Label passwordLabel;
		private AdapterField passwordAF;
		
		
		
//		private Label roomNoLabel;
//		private AdapterField roomNoAF;
		
//		private Label arrivalDateAndTimeLabel;
//		private AdapterField arrivalDateAndTimeAF;
//		
//		private Label departureDateAndTimeLabel;
//		private AdapterField departureDateAndTimeAF;
//		
//		private Label payMethodLabel;
//		private AdapterField payMethodAF;
////		private EasyClearCombobox<PaymentMethodModelData> paymentMethodCombo;
////		private ListStore<PaymentMethodModelData> paymentMethodListStore;
//		
//		private Label remarksLabel;
//		private AdapterField remarksAF;
//		
//		//private MySimpeGridPanel simGridPanel;
//		
//		private Label totalAmountLabel;
//		private AdapterField totalAmountAF;
//		
//		private FormButton okButton;
//
//		private LayoutContainer lc2;
		
		protected MyFormPanel(FormSubmitListener<iGuestUsersModel> l) {
			super(l);
			setHeaderVisible(false);
			
			lc1 = new LayoutContainer();
			lc1.setLayout(new ColumnLayout());
//			lc1.setBorders(true);
			lc1.setBorders(false);
			
			LayoutContainer left1 = new LayoutContainer();
			left1.setId("FolioDialog_left1");
			
			FormLayout layout = new FormLayout();
			layout.setLabelAlign(LabelAlign.LEFT);
			layout.setLabelWidth(100);
			layout.setDefaultWidth(100);
			left1.setLayout(layout);
			
			guestNameLabel = new Label();
			guestNameLabel.setId("FolioDialog_guestNameLabel");
			
			guestNameAF = new AdapterField(guestNameLabel);
			guestNameAF.setId("FolioDialog_guestNameAF");
			guestNameAF.setFieldLabel(ShareGWTConstants.SHARE_GWT_CONSTANTS.guestName());
			left1.add(guestNameAF);
			
			folioNoLabel = new Label();
			folioNoLabel.setId("FolioDialog_folioNoLabel");
			
			folioNoAF = new AdapterField(folioNoLabel);
			folioNoAF.setId("FolioDialog_folioNoAF");
			folioNoAF.setFieldLabel(CServiceConstants.CSERVICE_CONSTANTS.folioNo());
			left1.add(folioNoAF);
			
			
			
			roomNoLabel = new Label();
			roomNoLabel.setId("FolioDialog_roomNo");
			
			roomNoAF = new AdapterField(roomNoLabel);
			roomNoAF.setId("FolioDialog_roomNoAF");
			roomNoAF.setFieldLabel(ShareGWTConstants.SHARE_GWT_CONSTANTS.roomNo());
			left1.add(roomNoAF);
			
			extensionNoLabel = new Label();
			extensionNoLabel.setId("FolioDialog_genderLabel");
			
			extensionNoAF = new AdapterField(extensionNoLabel);
			extensionNoAF.setId("FolioDialog_extensionNoAF");
			extensionNoAF.setFieldLabel(CoreConstants.CORE_CONSTANTS.extenstionNo());
			left1.add(extensionNoAF);
			
			vipLevelLabel = new Label();
			vipLevelLabel.setId("FolioDialog_vipLevelLabel");
			
			vipLevelAF = new AdapterField(vipLevelLabel);
			vipLevelAF.setId("FolioDialog_vipLevelAF");
			vipLevelAF.setFieldLabel(CServiceConstants.CSERVICE_CONSTANTS.vipCodes());
			left1.add(vipLevelAF);
			
			groupIdLabel = new Label();
			groupIdLabel.setId("iGuestUserProfileDiaglog_groupIdLabel");
			groupIdAF = new AdapterField(groupIdLabel);
			groupIdAF.setId("iGuestUserProfileDiaglog_groupIdAF");
			groupIdAF.setFieldLabel(CoreConstants.CORE_CONSTANTS.group());
			left1.add(groupIdAF);
			
			iGuestAccountLabel = new Label();
			iGuestAccountLabel.setId("iGuestUserProfileDiaglog_iGuestAccountLabel");
			iGuestAccountAF = new AdapterField(iGuestAccountLabel);
			iGuestAccountAF.setId("iGuestUserProfileDiaglog_groupIdAF");
			iGuestAccountAF.setFieldLabel(CoreConstants.CORE_CONSTANTS.account());
			left1.add(iGuestAccountAF);
			
			usernameLabel = new Label();
			usernameLabel.setId("iGuestUserProfileDiaglog_usernameLabel");
			usernameAF = new AdapterField(usernameLabel);
			usernameAF.setId("iGuestUserProfileDiaglog_usernameAF");
			usernameAF.setFieldLabel(CoreConstants.CORE_CONSTANTS.username());
			left1.add(usernameAF);
			
			passwordLabel = new Label();
			passwordLabel.setId("iGuestUserProfileDiaglog_passwordLabel");
			passwordAF = new AdapterField(passwordLabel);
			passwordAF.setId("iGuestUserProfileDiaglog_passwordAF");
			passwordAF.setFieldLabel(CoreConstants.CORE_CONSTANTS.pwd());
			left1.add(passwordAF);
			
//			Label label = new Label(CServiceConstants.CSERVICE_CONSTANTS.totalAmount() + ":");
//			
//			totalAmountLabel = new Label(CServiceConstants.CSERVICE_CONSTANTS.totalAmount());
//			totalAmountLabel.setId("FolioDialog_totalAmountLabel");
//			
//			totalAmountAF = new AdapterField(totalAmountLabel);
//			totalAmountAF.setId("FolioDialog_totalAmountAF");
//			totalAmountAF.setFieldLabel(CServiceConstants.CSERVICE_CONSTANTS.totalAmount());
//			left1.add(totalAmountAF);
			
//			Label lblSperator = new Label("\n");
			
//			LayoutContainer right1 = new LayoutContainer();
//			right1.setId("FolioDialog_right1");
//			
//			layout = new FormLayout();
//			layout.setLabelAlign(LabelAlign.LEFT);
//			layout.setLabelWidth(160);
//			layout.setDefaultWidth(160);
//			right1.setLayout(layout);
//			
//			vipCodeLabel = new Label();
//			vipCodeLabel.setId("FolioDialog_vipCodeLabel");
//			
//			vipCodeAF = new AdapterField(vipCodeLabel);
//			vipCodeAF.setId("FolioDialog_vipCodeAF");
//			vipCodeAF.setFieldLabel(CServiceConstants.CSERVICE_CONSTANTS.vipCodes());
//			right1.add(vipCodeAF);
//			
//			roomNoLabel = new Label();
//			roomNoLabel.setId("FolioDialog_roomNoLabel");
//			
//			roomNoAF = new AdapterField(roomNoLabel);
//			roomNoAF.setId("FolioDialog_roomNoAF");
//			roomNoAF.setFieldLabel(ShareGWTConstants.SHARE_GWT_CONSTANTS.roomNo());
//			right1.add(roomNoAF);
//			
//			arrivalDateAndTimeLabel = new Label();
//			arrivalDateAndTimeLabel.setId("FolioDialog_arrivalDateAndTimeLabel");
//			
//			arrivalDateAndTimeAF = new AdapterField(arrivalDateAndTimeLabel);
//			arrivalDateAndTimeAF.setId("FolioDialog_arrivalDateAndTimeAF");
//			arrivalDateAndTimeAF.setFieldLabel(ShareGWTConstants.SHARE_GWT_CONSTANTS.arrivalDateAndTime());
//			right1.add(arrivalDateAndTimeAF);
//			
//			departureDateAndTimeLabel = new Label();
//			departureDateAndTimeLabel.setId("FolioDialog_departureDateAndTimeLabel");
//			
//			departureDateAndTimeAF = new AdapterField(departureDateAndTimeLabel);
//			departureDateAndTimeAF.setId("FolioDialog_departureDateAndTimeAF");
//			departureDateAndTimeAF.setFieldLabel(ShareGWTConstants.SHARE_GWT_CONSTANTS.departureDateAndTime());
//			right1.add(departureDateAndTimeAF);
//			
//			payMethodLabel = new Label();
//			payMethodLabel.setId("FolioDialog_payMethodLabel");
//			
//			payMethodAF = new AdapterField(payMethodLabel);
//			payMethodAF.setId("FolioDialog_payMethodAF");
//			payMethodAF.setFieldLabel(CServiceConstants.CSERVICE_CONSTANTS.paymentMethod());
//			right1.add(payMethodAF);
			
			//lc1.add(left1, new ColumnData(.45));
			lc1.add(left1);
//			lc1.add(right1, new ColumnData(.55));
			
			add(lc1);
			
//			remarksLabel = new Label();
//			remarksLabel.setId("FolioDialog_remarksLabel");
//			
//			remarksAF = new AdapterField(remarksLabel);
//			remarksAF.setId("FolioDialog_remarksAF");
//			remarksAF.setFieldLabel(ShareGWTConstants.SHARE_GWT_CONSTANTS.remarks());
//			
//			add(remarksAF);
			
			
			
			
//			
//			
//			
//			okButton = new FormButton(CoreConstants.CORE_CONSTANTS.ok());
//			okButton.setId("FolioDialog_okButton_id");
//			okButton.setWidth(60);
//			okButton.setStyleAttribute(CServiceConstants.CSS_MARGINLEFT, "360px");
//			okButton.addSelectionListener(new SelectionListener<ButtonEvent>(){
//				@Override
//				public void componentSelected(ButtonEvent ce) {
//					//FolioDialog.this.hide();
//				}
//			});
//			
//			lc2 = new LayoutContainer();
//			lc2.setId("FolioDialog_lc2");
//			lc2.setLayout(new ColumnLayout());
//			lc2.add(label, new ColumnData(100));
//			lc2.add(totalAmountAF, new ColumnData(100));
//			lc2.add(okButton, new ColumnData(70));
//			//lc2.add(exportBtn, new ColumnData(70));
//			
//			add(lc2);
		}

		@Override
		public void updateForm(iGuestUsersModel entity) {
			 //roomNum.setText(entity.getRoom());
			 //guestName.setText(entity.getGuestName());
			// categoryName.setText(entity.getCategroy());
			// status.setText(entity.getStatus());
			guestNameLabel.setText(entity.getGuestName());
			folioNoLabel.setText("Test Folio");
			roomNoLabel.setText("Test Room No");
			extensionNoLabel.setText("Test Extension No");
			vipLevelLabel.setText("Test Vip Level");
//			totalAmountLabel.setText("1111");
			usernameLabel.setText("Test username");
			passwordLabel.setText("Test password");
		}


		@Override
		public void populateEntity(iGuestUsersModel entity) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void setFocus() {

		}

	}

	
	@Override
	protected FcsFormPanel<iGuestUsersModel> getFormPanel() {
		return myFormPanel;
	}

}
